<?php
/**
 * Created by PhpStorm.
 * User: wangjie
 * Date: 2021/1/8
 * Time: 18:53
 */
namespace App\Api\Controllers;


trait ResponseInfo
{

    /**
     * 状态码对应的文字描述
     * @param $code
     * @return mixed
     */
    protected function getCodeMessage($code)
    {
        $codeMessage = [
            "200"               => "数据请求成功",
            "202"               => "参数未定义",
            "203"               => "请求方式不正确",
            "404"               => "请求地址不正确",
            "405"               => "用户未在该门店中授权，请先去授权",
            "4001"              => "user_id参数不可为空",
            "4002"              => "store_id参数不可为空",
            "4003"              => "terminal_type参数不可为空",
            "4004"              => "微信appid参数不可为空",
            "4005"              => "微信secret参数不可为空",
            "4006"              => "支付宝appid参数不可为空",
            "4007"              => "支付宝secret参数不可为空",
            "4008"              => "js_code参数不可为空",
            "4009"              => "支付宝认证code不可为空",
            "4010"              => "手机号参数不可为空",


            //服务商端
            "1"               => "数据返回成功",
            "2"               => "暂无数据",

            "100001"               => "非平台用户,config_id与phone不同,暂无法操作",


            "150001"               => "失效的天猫精灵激活码，请重新生成",
            "150002"               => "天猫精灵绑定门店成功",
            "150003"               => "天猫精灵绑定门店失败",
            "150004"               => "天猫精灵生成激活码成功",
            "150005"               => "天猫精灵生成激活码失败",
            "150006"               => "天猫精灵唯一编码不能为空",
            "150007"               => "天猫精灵激活码不能为空",
            "150008"               => "天猫精灵绑定列表删除成功",
            "150009"               => "天猫精灵绑定列表删除失败",
            "150010"               => "请勿重复绑定天猫精灵",
            "150011"               => "该激活码已绑定门店,请确认",
            "150012"               => "该设备已有激活码,请确认",
            "150013"               => "该设备尚未绑定门店,请确认",
            "150014"               => "该设备尚未生成激活码,请确认",


            "160001"               => "公告栏添加成功",
            "160002"               => "公告栏添加失败",
            "160003"               => "公告栏修改成功",
            "160004"               => "公告栏修改失败",
            "160005"               => "公告栏删除成功",
            "160006"               => "公告栏删除失败",


            "170001"               => "链接添加成功",
            "170002"               => "链接添加失败",
            "170003"               => "链接修改成功",
            "170004"               => "链接修改失败",
            "170005"               => "链接删除成功",
            "170006"               => "链接删除失败",


            "180001"               => "用户分配权限成功",
            "180002"               => "用户分配权限失败",
            "180003"               => "删除权限成功",
            "180004"               => "删除权限失败",
            "180005"               => "当前账号无权删除",


            "190001"               => "用户不存在或状态异常",


            "200001"               => "没有'银盛配置'权限",
            "200002"               => "银盛支付配置,type参数不正确",
            "200003"               => "银盛支付配置,保存成功",
            "200004"               => "银盛支付配置,保存失败",

            "200101"               => "没有'钱方配置'权限",
            "200102"               => "钱方支付配置,type参数不正确",
            "200103"               => "钱方支付配置,保存成功",
            "200104"               => "钱方支付配置,保存失败",




            //商户端



            //以下是微信官方代码code
            "-1"                => "系统繁忙，请稍候再试",
            "0"                 => "请求成功",
            "1003"              => "POST参数非法",
            "20002"             => "商品id不存在",
            "40001"             => "获取 access_token 时 AppSecret 错误，或者 access_token 无效",
            "40002"             => "不合法的凭证类型",
            "40003"             => "不合法的 OpenID ，请开发者确认 OpenID （该用户）是否已关注公众号，或是否是其他公众号的 OpenID",
            "40004"             => "不合法的媒体文件类型",
            "40005"             => "上传素材文件格式不对",
            "40006"             => "上传素材文件大小超出限制",
            "40007"             => "不合法的媒体文件 id",
            "40008"             => "不合法的消息类型",
            "40009"             => "图片尺寸太大",
            "40010"             => "不合法的语音文件大小",
            "40011"             => "不合法的视频文件大小",
            "40012"             => "不合法的缩略图文件大小",
            "40013"             => "不合法的appid",
            "40014"             => "不合法的 access_token ，请开发者认真比对 access_token 的有效性（如是否过期），或查看是否正在为恰当的公众号调用接口",
            "40015"              => "不合法的菜单类型",
            "40016"              => "不合法的按钮个数",
            "40017"              => "不合法的按钮类型",
            "40018"              => "不合法的按钮名字长度",
            "40029"              => "无效的 oauth_code",
            "40030"              => "不合法的 refresh_token",
            "40031"              => "不合法的 openid 列表",
            "40032"              => "不合法的 openid 列表长度",
            "40033"              => "不合法的请求字符，不能包含 \uxxxx 格式的字符",
            "40036"              => "不合法的 template_id 长度",
            "40037"              => "不合法的 template_id",
            "40038"              => "不合法的请求格式",
            "40039"              => "不合法的 URL 长度",
            "40097"              => "参数错误",
            "40132"              => "微信号不合法",
            "41001"              => "缺少 access_token 参数",
            "41002"              => "缺少 appid 参数",
            "41003"              => "缺少 refresh_token 参数",
            "41004"              => "缺少 secret 参数",
            "41005"              => "缺少多媒体文件数据，传输素材无视频或图片内容",
            "41006"              => "缺少 media_id 参数",
            "41007"              => "缺少子菜单数据",
            "41033"              => "只允许通过api创建的小程序使用",
            "53300"              => "超出每月次数限制",
            "53301"              => "超出可配置类目总数限制",
            "85001"              => "微信号不存在或微信号设置为不可搜索",
            "85002"              => "小程序绑定的体验者数量达到上限",
            "85003"              => "微信号绑定的小程序体验者达到上限",
            "85004"              => "微信号已经绑定",
            "85005"              => "appid not bind weapp",
            "85006"              => "标签格式错误",
            "85007"              => "页面路径错误",
            "85008"              => "类目填写错误",
            "85009"              => "已经有正在审核的版本",
            "85010"              => "item_list 有项目为空",
            "85011"              => "标题填写错误",
            "85012"              => "无效的审核 id",
            "85013"              => "无效的自定义配置",
            "85014"              => "无效的模板编号",
            "85015"              => "该账号不是小程序账号",
            "85016"              => "域名数量超过限制 ，总数不能超过1000",
            "85017"              => "没有新增域名，请确认小程序已经添加了域名或该域名是否没有在第三方平台添加",
            "85018"              => "域名没有在第三方平台设置",
            "85019"              => "没有审核版本",
            "85020"              => "审核状态未满足发布",
            "85023"              => "审核列表填写的项目数不在 1-5 以内",
            "85043"              => "模板错误",
            "85044"              => "代码包超过大小限制",
            "85045"              => "ext_json 有不存在的路径",
            "85046"              => "tabBar 中缺少 path",
            "85047"              => "pages 字段为空",
            "85048"              => "ext_json 解析失败",
            "85051"              => "version_desc或者preview_info超限",
            "85064"              => "找不到模板",
            "85065"              => "模板库已满",
            "85066"              => "链接错误",
            "85074"              => "小程序未发布, 小程序必须先发布代码才可以发布二维码跳转规则",
            "85077"              => "小程序类目信息失效（类目中含有官方下架的类目，请重新选择类目）",
            "85079"              => "小程序没有线上版本，不能进行灰度",
            "85080"              => "小程序提交的审核未审核通过",
            "85085"              => "小程序提审数量已达本月上限",
            "85086"              => "提交代码审核之前需提前上传代码",
            "86000"              => "不是由第三方代小程序进行调用",
            "86001"              => "不存在第三方的已经提交的代码",
            "86002"              => "小程序还未设置昵称、头像、简介。请先设置完后再重新提交",
            "86007"              => "小程序禁止提交",
            "87011"              => "现网已经在灰度发布，不能进行版本回退",
            "87012"              => "该版本不能回退，可能的原因：1:无上一个线上版用于回退 2:此版本为已回退版本，不能回退 3:此版本为回退功能上线之前的版本，不能回退",
            "87013"              => "撤回次数达到上限（每天一次，每个月 10 次）",
            "80082"              => "没有权限使用该插件",
            "80067"              => "找不到使用的插件",
            "80066"              => "非法的插件版本",
            "9402202"            => "请勿频繁提交，待上一次操作完成后再提交",
            "85094"              => "需提供审核机制说明信息",
            "86009"              => "服务商新增小程序代码提审能力被限制",
            "86010"              => "服务商迭代小程序代码提审能力被限制",
            "91001"              => "不是公众号快速创建的小程序",
            "91002"              => "小程序发布后不可改名",
            "91003"              => "改名状态不合法，小程序发布前可改名的次数为2次，请确认改名次数是否已达上限",
            "91004"              => "昵称不合法",
            "91005"              => "昵称 15 天主体保护",
            "91006"              => "昵称命中微信号",
            "91007"              => "昵称已被占用",
            "91008"              => "昵称命中 7 天侵权保护期",
            "91009"              => "需要提交材料",
            "91010"              => "其他错误",
            "91011"              => "查不到昵称修改审核单信息",
            "91012"              => "其他错误",
            "91013"              => "占用名字过多",
            "91014"              => "+号规则 同一类型关联名主体不一致",
            "91015"              => "原始名不同类型主体不一致",
            "91016"              => "名称占用者 ≥2",
            "91017"              => "+号规则 不同类型关联名主体不一致",
            "53010"              => "名称格式不合法",
            "53011"              => "名称检测命中频率限制",
            "53012"              => "禁止使用该名称",
            "53013"              => "公众号：名称与已有公众号名称重复;小程序：该名称与已有小程序名称重复",
            "53014"              => "公众号：公众号已有{名称 A+}时，需与该帐号相同主体才可申请{名称 A};小程序：小程序已有{名称 A+}时，需与该帐号相同主体才可申请{名称 A}",
            "53015"              => "公众号：该名称与已有小程序名称重复，需与该小程序帐号相同主体才可申请;小程序：该名称与已有公众号名称重复，需与该公众号帐号相同主体才可申请",
            "53016"              => "公众号：该名称与已有多个小程序名称重复，暂不支持申请;小程序：该名称与已有多个公众号名称重复，暂不支持申请",
            "53017"              => "公众号：小程序已有{名称 A+}时，需与该帐号相同主体才可申请{名称 A};小程序：公众号已有{名称 A+}时，需与该帐号相同主体才可申请{名称 A}",
            "53018"              => "名称命中微信号",
            "53019"              => "名称在保护期内",
            "40125"              => "无效的appsecret",
            "45009"              => "接口调用超过限制",
            "47001"              => "解析 JSON/XML 内容错误",
            "48001"              => "api 功能未授权，请确认公众号/小程序已获得该接口，可以在公众平台官网 - 开发者中心页中查看接口权限",
            "42001"              => "access_token 超时，请检查 access_token 的有效期，请参考基础支持 - 获取 access_token 中，对 access_token 的详细机制说明",
            "53202"              => "本月头像修改次数已用完",
            "46001"              => "media_id 不存在",
            "85052"              => "小程序重复发布",
        ];

        if (isset($codeMessage[$code])) {
            return $codeMessage[$code];
        } else {
            return null;
        }
    }


}
